package com.six.controller;

import com.six.domain.vo.MenuRespVo;
import com.six.service.MenuService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/menu")
@RequiredArgsConstructor
public class MenuController {
    private final MenuService menuService;

    // 一次性把菜品和分类都返回，省两次请求
    @GetMapping
    public MenuRespVo getMenu(@RequestParam Long storeId) {   // 删掉 defaultValue
        return menuService.buildMenu(storeId);
    }
}